package com.peace.hospital.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peace.hospital.entity.hospitalization.entity.Department;
import com.peace.hospital.entity.hospitalization.entity.Inpatientmessage;
import com.peace.hospital.entity.hospitalization.entity.dto.AllchargeDto;
import com.peace.hospital.entity.hospitalization.entity.dto.InpatientmessageDto;
import com.peace.hospital.mapper.InpatientmessageMapper;
import com.peace.hospital.service.IInpatientmessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 入库单表和药房表（多对多） 服务实现类
 * </p>
 *
 * @author xie
 * @since 2019-11-06
 */
@Service
public class InpatientmessageServiceImpl extends ServiceImpl<InpatientmessageMapper, Inpatientmessage> implements IInpatientmessageService {

    @Autowired
    private InpatientmessageMapper inpatientmessageMapper;






    @Override
    public Inpatientmessage selectInpatientMessage(InpatientmessageDto dto) {
        return inpatientmessageMapper.selectInpatientMessage(dto.getPeople());
    }

    @Override
    public boolean insertInner(Inpatientmessage dto) {
        return (inpatientmessageMapper.insertInner(dto)!=0);
    }

    /**
     * 获取所有住院病人的信息
     * @return
     */
    @Override
    public List<Inpatientmessage> getAll(Department department) {
        //添加基础信息
        List<Inpatientmessage> list =  inpatientmessageMapper.getAll(department.getDepid());

        return list;
    }

    @Override
    public boolean updateOut(Inpatientmessage dto) {
        return (inpatientmessageMapper.updateOut(dto)!=0);
    }

    @Override
    public Integer updateNewMessage(Inpatientmessage dto) {
        return inpatientmessageMapper.updateNewMessage(dto);
    }

    @Override
    public List<AllchargeDto> selectDebts() {
        return inpatientmessageMapper.selectDebts();
    }


}
